package com.yanqu.road.web.listen;

import com.yanqu.road.web.WebServer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.util.ResourceUtils;

import java.io.File;

//@WebListener
public class GameWebInitListener {

	private static final Logger logger = LogManager.getLogger(WebServer.class.getName());

	private static String configPath;

	public static String getConfigPath() {
		return configPath;
	}

	public static boolean webServerInit() {
		logger.info("webServer start");
		try {
			configPath = ResourceUtils.getFile("").getAbsolutePath() + File.separator+ "config" +File.separator;
			return WebServer.getInstance().start();
		} catch (Exception e) {
			logger.error(e.getMessage(),e);
			return false;
		}
	}
}
